package com.bowos.zmado.model;

import com.orifine.orm.annotation.Column;
import com.orifine.orm.annotation.Id;
import com.orifine.orm.annotation.Length;
import com.orifine.orm.annotation.NotNull;
import com.orifine.orm.annotation.Table;
import com.orifine.orm.annotation.Unique;
import com.orifine.orm.information.AutoIncrementInfo;
import com.orifine.orm.information.ValueListInfo;
import com.orifine.orm.model.ColumnModel;
import com.orifine.orm.model.TableModel;
import com.orifine.web.Validator;
import com.orifine.web.validate.FormatRule;
import com.orifine.web.validate.StringLengthRule;

/**
 * 用户
 * 
 * @author Administrator
 * 
 */
@Table
public class User {
	public static final TableModel table = new TableModel();

	@Id
	@Column
	@NotNull
	private Integer id;

	public static final ColumnModel columnId = new ColumnModel().setInformation(new AutoIncrementInfo(1000, 5));

	@Column
	@Length(32)
	@Unique
	@NotNull
	private String username;

	public static final ColumnModel columnUsername = new ColumnModel().setValidate(new Validator[] {
			StringLengthRule.range(4, 32),
			FormatRule.pattern("^[_a-zA-Z0-9\u4e00-\u9fa5]+$")
	}).setInformation(new ValueListInfo(new Object[] { "luckeast", "administrator" }, String.class));
	
	@Column
	@Length(32)
	@NotNull
	private String password;

	public static final ColumnModel columnPassword = new ColumnModel().setValidate(new Validator[] {
			StringLengthRule.range(4, 32)
	}).setInformation(new ValueListInfo(new Object[] { "1234", "1234" }, String.class));

	@Column
	@Length(50)
	@NotNull
	private String email;
	
	public static final ColumnModel columnEmail = new ColumnModel().setValidate(new Validator[] {
			FormatRule.email()
	});

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
}
